package com.tea.tea_vue.Controller;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.tea.tea_vue.Mapper.SellsMapper;
import com.tea.tea_vue.Service.SellService;
import org.springframework.boot.configurationprocessor.json.JSONException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
@RequestMapping("/sells")
@CrossOrigin(value = "*")
public class SellController {
    @Resource
    private SellService sellService;
    @Resource
    private SellsMapper sellsMapper;

    @GetMapping("/listAll/{pageNum}/{pageSize}")
    @ResponseBody
    public String sellPage(@PathVariable("pageNum") Integer pageNum,
                           @PathVariable("pageSize") Integer pageSize) throws JSONException, JsonProcessingException {
        String sellList = sellService.getSellList(pageNum, pageSize);
        System.out.println(sellList);
        return sellList;
    }
}
